import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:pdf/utils/Tool/MyTools.dart';
import 'package:pdf/utils/sputils/SpUtils.dart';
import '../../utils/EventBus/EventBus.dart';
import 'package:get/get.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:sp_util/sp_util.dart';

import 'config/Constant.dart';
import 'internationalization/message.dart';
import 'ui/splash/SplashPage.dart';

GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

Future<void> main() async {
  SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarIconBrightness: Brightness.dark);
  SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);

  init();

  /// 初始化
  runApp(GetMaterialApp(
      debugShowCheckedModeBanner: false,

      title: 'PDF EDIT',
      translations: Messages(),
      // 你的翻译
      locale: const Locale('en', 'en'),
      // builder: FToastBuilder(),
      builder: EasyLoading.init(),
      navigatorKey: navigatorKey,
      // 默认指定的语言翻译
      fallbackLocale: const Locale('en', 'en'),
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage()));
}

void init() {
  WidgetsFlutterBinding.ensureInitialized();

  MobileAds.instance.initialize();

  ///初始化EventBusUtil
  EventBusUtil.instance;

  SpUtil.getInstance();


}
